home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Assassins - Ultimate CD Games Collection 2
/
Assassins 2 - Ultimate Games No. 2 (1995)(Weird Science)[!][Amiga-CD32-CDTV].iso
/
disks
/
wbgames4.dms
/
wbgames4.adf
/
MINESWEEPER
/
README
< prev
next >
Wrap
Text File
|
1994-06-29
|
8KB
|
190 lines
Short: Minesweeper-clone, incl. C++-source
---------------------------------------------------------------------------
AMIGA Minesweeper V0.98
~~~~~~~~~~~~~~~~~~~~~~~~~
What's it?
~~~~~~~~~~
This is the 3rd game whick imitates MS-Window's "Minesweeper" which
is based on X's "XMines" (or vice versa?). The two others appeared on
Fish disk #541 (MineClearer, by Kopetzky Theodorich) and #707 (AMines,
by Manfred Huesmann).
Features:
~~~~~~~~~
- OS2.0 only! ("It's a feature, not a bug!")
- Adjusts to font-size (Developped using Thin611/11)
- Adjusts to Non-/Interlace
- No GAME-OVER on first try
- MS-Windows-like look&feel
- C++-Source included!
How to play
~~~~~~~~~~~
The aim is to detect all mines in a minefield. Selecting a field (by
pressing the left mouse-button) shows the number of mines in the
surrounding 8 fields. Or it terminates the game, if you "step" on a
mine! The game's won when all mines are marked with an 'X' (right
mouse-button) and all other fields are selected. The gadget in the
upper-left corner tells you, how many mines are left to be marked,
but be careful! It doesn't tell you whether you really marked some
mines or just empty fields! Besides that, you can mark more fields
than there are mines, thus, getting the counter below zero.
To give it all a certain thrill, there's a watch in the upper right
corner, displaying how many seconds wou're already playing. The faster
you are, the better! My high-score for the standard-8x8-board is 8
seconds.
Installation
~~~~~~~~~~~~
AMIGA Minesweeper relies on Markus Wilds ixemul.library, which is
provided in the libs-Directory, please watch the COPYING-file. To
install, copy the lib into your libs:-directory or add a multi-assign
on "libs" to "libs:". And that's all there is. Happy sweeping!
Invoking
~~~~~~~~
At present time, the game may only be launched from CLI/shell.
Synopsis:
mine [x-dimension y-dimension [percentage]]
The arguments are all integers. If none are given, a 8x8-board is given
which contains 15% mines. The window's always centered on the screen.
The maximum x/y-dimension depend on your font and screenmode! By the
way, the default-values are the same as for MS-Window's Minesweeper at
"Beginner-Level". Here's the full table of Minesweeper's settings:
| x-dim | y-dim | %
-------------------+----------+---------+----
Beginner | 8 | 8 | 15
Intermediate | 16 | 16 | 15
Expert | 30 | 16 | 20
Yes, this should be put into a menu! I'll do it 'till the next release...
After you finish one game (either by winning or loosing), the "GO!"-
button in the upper-middle becomes active and you can get another try
by pressing it. Two remarks here:
- The timer starts when you set your first mark or select the first
field, not when you press the "GO!"-Button.
- If you hit a mine on the very-first try, the mine will be moved some-
where else and you won't be telled. MineClearer didn't have this
feature and I can't remember whether AMines had it!
Technical details:
~~~~~~~~~~~~~~~~~~
Well, the program's written using Markus Wild's port of the GNU-C++-
Compiler. Why C++, you ask? Well, why not?! First I have to say that
this is my 1st prog which deals with gadgets and I'm currently reading
(the awful translation of) Bjarne Stroustrup's book "The C++ programming
language".
Initially, I wanted to keep the "minefield" as a 2-dimensional array
on some structure, but I didn't like that too much. So, to learn not
only programming the Amiga but to do also some basic things in C++, I
decided it to be an array of pointers to objects. Each object repre-
sents one field in the minefield, therefore the object-type is called
"Field". Each Field-object mainly contains:
- a pointer to it's gadget (representing the object on the screen).
- a short txt-array, which contains the label of the [fF]ield
Besides that, I put the pointer to the object {this} into the gadget's
"UserData"-field {field.cc: _gad->UserData = (APTR)this}. Thus, when
Intuition signals me an IDCMP_GADGETUP, I've just to read the UserData-
field to get a reference to the entire object without having to seach
the whole minefield-array to get the reference. That's a real Callback!
~~~~~~~~~
After getting the selected field/object, I just give it the command to
check itself {f->check()}. The Field-object changes the gadget to a
SELECTED-state (using the Field::open()-function) and checks for any
mines. If there are none in any of the surrounding fields, it check()s
each one of then in a nested way (Rekursion, auf gut Deutsch!).
However, the callback doesn't work with the right mousebutton. For this
reason, I get the object's position in the minefield[][] from the mouse-
coordinates. After that, it's an easy thing marking the field, using the
Field::mark()-member-function.
There's one general problem when doing Amiga-programming with C++. After
the definition, the keyword "struct" is redundant, i. e. you can write
struct ab { int a,b; }; // Define struct
ab x; // struct ab x;
This crashes in many system-structs, mainly in Intuition. It starts with
IntuitionBase: that's a type-name, but it's also the name of a variable,
the base-adress of the Intuition-library! (It's no matter that the
variable is a pointer!). Other examples are "struct View *View" in the
Viewextra-struct from <graphics/view.h> and GfxBase.
How to deal with this problem? The variable's name is used in amiga.lib
(libamiga.a), so the only way is to rename the type. Here's a way how to
do it (inspired by M. Wild's TrueMultiAssign):
#define IntuitionBase IntuiBase
# include <intuition/intuitionbase.h>
#undef IntuitionBase
IntuiBase *IntuitionBase;
This is the only solution I can come up. Do YOU have a better one? Please
tell me YOUR opinion!
To do:
~~~~~~
- Auto-play-option (This was what I intended first: a Minesweeper that
solves itself! Shouldn't be too difficult)
- Intuition-Menus + Requester for "Custon"-settings
- WB-Startup-Code & Command-Line-Parsing
- Highscore-List
- Plugging up that memory-leak
Bug(s):
~~~~~~~
Each time you invoke the game, you loose some (fast) memory!
The amount ranges from 150 bytes to about 30 Kbytes! It would
be quite good for me to know where those bytes go. Read the
source and tell me why!
Thanks to:
~~~~~~~~~~
- Markus Stipp (MSCalendar) => various font-stuff
- Stuart Mitchell (Clock V1.4) => timer.device-handling
- Alexandru-Aurel Balmosan (ALoad) => Gadget-stuff
- Markus Wild => C++-Compiler ;-)
Legal stuff:
~~~~~~~~~~~~
The Program "AMIGA Minesweeper V0.98" and it's Source are freely
distributably, although they remain (c)opyrighted 1992 by me. It's
OK to spread it on any PD-disks, as long as their charge doesn't
exceed 5,- DM or an equal amount in any other currency. It may be
copied and distributed via electronic networks suc has Internet
and it may also be put on anonymouse ftp-servers, BBS', ...
The program may not not be altered and redistributed in any way!
Please ask me first, also if you have some ideas!
Although the development of the game was sped up by consulting
various sources from other people (see "Thanks"), no code from any
other program is used.
Author: Hubert Feyrer
~~~~~~~ Bachstr. 40
W-8304 Mallersdorf
Tel.: 08772 / 6084
Email: c9020@rrzc1.rz.uni-regensburg.de [132.199.40.1]
>>>> ANY RESPONSE WELCOME! <<<<